import { instance as request } from '../request'

/**
 * 创建示例
 * @param data
 * @returns
 */
export const createExampleApi = (data: createExampleItf): PromiseRes =>
  request.post('/example/create', data)

/**
 * 更新示例
 * @param data
 * @returns
 */
export const updateExampleApi = (data: updateExampleItf): PromiseRes =>
  request.put('/example/update', data)

/**
 * 删除示例
 * @param id 示例id
 * @returns
 */
export const deleteExampleApi = (id: string): PromiseRes =>
  request.delete(`/example/delete/${id}`)

/**
 * 获取示例 的笔记列表
 * @param id 示例id
 * @returns
 */
export const getExampleNoteListApi = (
  id: string
): PromiseRes<getNoteResultItf[]> => request.get(`/example/noteList/${id}`)

/**
 * 获取实例详情
 * @param id 示例id
 * @returns
 */
export const getExampleDetailApi = (
  id: string
): PromiseRes<getExampleResultItf> => request.get(`/example/detail/${id}`)
